package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface EmployeeMapper {
    //登录根据用户名查找
    @Select("select * from employee where username=#{username}")
    Employee selectEmployeeByUsernameAndPassword(Employee employee);
    //分页查询
    List<Employee> selectByPage(@Param("begin") long begin, @Param("pageSize")long pageSize, @Param("name") String name);

    long count(String name);
    //添加员工
    @Insert("insert into employee values(null,#{name},#{username},#{password},#{phone},#{sex},#{idNumber},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    Integer add(Employee employee);
    //修改员工信息
    Integer update(Employee employee);
    //根据id查找员工
    @Select("select * from employee where id=#{id}")
    Employee findById(Integer id);


}
